<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>订单监控页</title>
<link href="/assets/css/bootstrap.min.css" type="text/css" rel="stylesheet">
<script language="JavaScript" src="/assets/js/jquery-1.8.1.min.js" type="text/javascript"></script>
<script language="JavaScript" src="/assets/js/bootstrap.min.js" type="text/javascript"></script>
<script language="javascript">
$(document).ready(function(){
	$(".order-check a").click(function(){
		
		var _this = $(this)	;
		var _on = _this.parent().attr("data-itme");
		var _type = _this.attr("class");
		$.getJSON("<?php echo site_url('order/ajax_order_status')?>/"+_on+"/"+_type, function(data){
			if(data.code == "1000")	{
				alert(data.msg);
				_this.parent().parent().parent().find(".order-status").html(data.data);
				_this.parent().parent().parent().addClass(".success")	
			} else {
				alert(data.msg);
			}
		})
	})
	
})
</script>
</head>

<body>
<div class="navbar navbar-inverse navbar-fixed-top">
  <div class="navbar-inner">
    <div class="container-fluid">
      <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
      <a class="brand" href="#">外卖联盟订单监控平台</a>
      <div class="nav-collapse collapse">
        <p class="navbar-text pull-right"> 登录管理员 <a href="#" class="navbar-link">admini</a> </p>
        <ul class="nav">
          <li class="active"><a href="#">区域分组管理</a></li>
          <li><a href="#about">区域商家管理</a></li>
          <li><a href="#contact">菜品管理</a></li>
          <li><a href="#contact">菜品分类管理</a></li>
        </ul>
      </div>
      <!--/.nav-collapse --> 
    </div>
  </div>
</div>
<!--内容管理-->
<div style="height:50px; clear:both; background:red"></div>
<div class="container-fluid">
  <div class="row-fluid">
    <div class="span3">
      <h3>订单管理</h3>
    </div>
  </div>
  <div class="row-fluid">
    <div class="span12">
      <table class="table table-hover">
        <thead>
          <tr>
            <th>#</th>
            <th>订单编号</th>
            <th>状态</th>
            <th>订单时间</th>
            <th>联系电话</th>
            <th>送餐地址</th>
            <th>送餐商家</th>
            <th>订单操作</th>
          </tr>
        </thead>
        <tbody>
        <?php
        if($order) {
			$index = 1;
			$HtmlClass = NULL;
			foreach($order AS $list) {
				if($list['order_status'] == "verify") {
					$HtmlClass = " class=\"success\""; 	
				}
		?>
          <tr<?php echo $HtmlClass; ?> id="order-<?php echo $list['OrderNumber']; ?>">
            <td><?php echo $index; ?></td>
            <td><?php echo $list['OrderNumber']; ?></td>
            <td class="order-status"><?php echo $status[$list['order_status']]?></td>
            <td><?php echo $list['OrderTime']?></td>
            <td><?php echo $list['Phone']; ?></td>
            <td><?php echo $list['Address']; ?></td>
            <td>时食外卖</td>
            <td>
            <span class="order-check" data-itme="<?php echo $list['OrderNumber']; ?>">
            <a href="javascript:;" class="processed">验证通过</a> |
            <a href="javascript:;" class="wait">送餐中</a> | 
            <a href="javascript:;" class="invalid">无效</a> | 
            <a href="javascript:;" class="complete">完成</a> | 
            </span>
            <span class="order-info" data-userid="<?php echo $list['UserID']; ?>" data-orderid="<?php echo $list['OrdID']?>">
            <a href="javascript:;" class="detail">详细</a>
            <a href="javascript:;" class="sendsms">发送信息</a>
            </span>
            </td>
          </tr>
          <?php
		  $index++;
			}
		}
		  ?>
        </tbody>
      </table>
    </div>
  </div>
</div>
</body>
</html>